package data.model;

import java.util.Date;
import data.model.Need;

public class Events {

    private Truck  T;
    private String nom;
    private Need   need;
    private String client;
    private Date   debut;
    private Date   fin;


    //constructors
    public Events()
    {}
    
    public Events(String cl, float weight, float mp, float price, Date D, Date F){}

    public Events(String cl, Need be, Date D, Date F) {
	this.client = cl;
	this.need   = be;
	this.debut  = D;
	this.fin    = F;
    }

    //getters
    public String getClient() {
	return this.client;
    }

    public Need getNeed() {
	return this.need;
    }

    public Date getDebut() {
	return this.debut;
    }

    public Date getFin() {
	return this.fin;
    }

    public float getMp(){
	return need.getMp();
    }

    public float getPoids(){
	return need.getWeight();
    }

    public float getPrix(){
	return need.getPrice();
    }

    public Truck getTruck(){
	return T;
    }

    //accesseur
    public void setClient(String cl) {
	this.client = cl;
    }

    public void setNeed(Need B) {
	this.need = B;
    }

    public void setDebut(Date D) {
	this.debut = D;
    }

    public void setFin(Date F) {
	this.fin = F;
    }

/*    public void setMp(float F){
	need.aMp( F);
    }
    
    public void setWeight(float P){
	need.aWeight( P);
    }

    public void setPrice(float P){
	need.aPrice( P);
    }
*/

    //Methode associee
    public boolean saveEvent(){
	// cf Jetty

	return true;
    } //TODO


    public boolean compareEvent(Events E) {
	return true;
    } //TODO

    public void printEvent(){
	String buffer = "event: "       +this.ToString()+"\n\n";
	buffer       += "Truck: "       + this.getTruck();
	buffer       += "Client: "      + this.getClient();
	buffer       += "Besoin:\n mp:" + this.getMp()+"\npoids: "+this.getPoids();
	buffer       += "prix: "        + this.getPrix();
	buffer       += "Debut: "       + this.getDebut();
	buffer       += "Fin: "         + this.getFin();
	
		
    } //TODO
    


    // @Override
    String ToString(){
	return nom;
    }
}
